//
//  ChongViewController.m
//  家范
//
//  Created by 吴军虎吴军虎 on 16/4/13.
//  Copyright © 2016年 lanjue. All rights reserved.
//

#import "ChongViewController.h"

@interface ChongViewController ()

@property (nonatomic,retain) UIView *myheaderView;
@property (nonatomic,retain) UIView *myFootView;
@property (nonatomic,retain) UITextField *shulabel;

@end

@implementation ChongViewController

-(void) viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden=YES;
}

-(void) viewWillDisappear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden=NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor=LV;
    
    self.title=@"充值";
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(Back:)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];

    //内容
    [self createFoot];
}


#pragma mark 内容
-(void) createFoot
{
    //白框
    _myFootView=[[UIView alloc]init];
    _myFootView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:_myFootView];
    [_myFootView mas_makeConstraints:^(MASConstraintMaker *make){
    
    
        make.top.equalTo(self.view).offset(50/2 *AUTO_WIDTH);
        make.left.equalTo(self.view).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 88/2 *AUTO_WIDTH));
    }];
    
    
    //充值金额
    UILabel *jinlabel=[[UILabel alloc]init];
    [self setUpChildViewController:jinlabel text:@"充值金额" textColor:[UIColor blackColor] alpha:0.8 font:[UIFont systemFontOfSize:18]];
    [jinlabel mas_makeConstraints:^(MASConstraintMaker *make){
    
        make.top.equalTo(_myFootView.mas_top).offset(23/2 *AUTO_WIDTH);
        make.left.equalTo(_myFootView.mas_left).offset(50/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(80 *AUTO_WIDTH, 25 *AUTO_WIDTH));
        
    }];
    
    //元
    UILabel *yuanlabel=[[UILabel alloc]init];
    [self setUpChildViewController:yuanlabel text:@"元" textColor:[UIColor blackColor] alpha:0.8 font:[UIFont systemFontOfSize:15]];
    [yuanlabel mas_makeConstraints:^(MASConstraintMaker *make){
    
        make.top.equalTo(_myFootView.mas_top).offset(22/2 *AUTO_WIDTH);
        make.right.equalTo(_myFootView.mas_right).offset(-25/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(25 *AUTO_WIDTH, 25 *AUTO_WIDTH));
    }];
    
    //输入金额
    _shulabel=[[UITextField alloc]init];
    _shulabel.textColor=[UIColor blackColor];
    _shulabel.placeholder=@"输入金额";
    _shulabel.textAlignment=NSTextAlignmentRight;
    _shulabel.keyboardType=UIKeyboardTypeNumberPad;
    _shulabel.font=[UIFont systemFontOfSize:18];
    _shulabel.adjustsFontSizeToFitWidth=YES;
    [_myFootView addSubview:_shulabel];
    [_shulabel mas_makeConstraints:^(MASConstraintMaker *make){
    
        make.top.equalTo(_myFootView.mas_top).offset(15/2 *AUTO_WIDTH);
        make.right.equalTo(yuanlabel.mas_left).offset(-10/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(120 *AUTO_WIDTH, 35 *AUTO_WIDTH));
    }];
    
    //下一步
    UIButton *xiabtn=[UIButton buttonWithType:UIButtonTypeCustom];
    xiabtn.backgroundColor=GH;
    [xiabtn setTitle:@"下一步" forState:UIControlStateNormal];
    [xiabtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [xiabtn addTarget:self action:@selector(xiaAction:) forControlEvents:UIControlEventTouchUpInside];
    xiabtn.titleLabel.font=[UIFont fontWithName:@"Arial" size:LOGINFONT *TEXTWEIGHT];
    xiabtn.layer.cornerRadius=5;
    [self.view addSubview:xiabtn];
    [xiabtn mas_makeConstraints:^(MASConstraintMaker *make){
    
        make.top.equalTo(_myFootView.mas_bottom).offset(92/2 *AUTO_WIDTH);
        make.left.equalTo(self.view).offset(44/2 *AUTO_WIDTH);
        make.right.equalTo(self.view).offset(-44/2 *AUTO_WIDTH);
        make.height.mas_equalTo(78/2 *AUTO_WIDTH);
    }];
    
}

#pragma  mark 添加所有的UILabel
-(void) setUpChildViewController:(UILabel *) label text:(NSString *) text textColor:(UIColor *) textColor alpha:(CGFloat) alpha font:(UIFont *) font
{
    label.text=text;
    label.textColor=textColor;
    label.alpha=alpha;
    label.font=font;
    [self.view addSubview:label];
}

//返回按钮
-(void) Back:(UIButton *) btn
{
    NSArray *array=self.navigationController.viewControllers;
    [self.navigationController popToViewController:[array objectAtIndex:1] animated:YES];
}

//下一步
-(void) xiaAction:(UIButton *) btn
{
    NSLog(@"下一步下一步下一步");
}


@end
